import 'package:flutter/material.dart';
import 'package:yiyan/ui/HomePage.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppSate();
}

class _MyAppSate extends State<MyApp> {
  bool darkModeOn = false;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '一言',
      theme: ThemeData(
          brightness: darkModeOn ? Brightness.dark : Brightness.light,
          primarySwatch: Colors.blue,
          fontFamily: 'AaShuYunSong'),
      home: Stack(children: [
        const HomePage(),
        Positioned(
          right: 20,
          top: 40,
          child: SizedBox(
            width: 30,
            height: 30,
            child: MaterialButton(
              padding: const EdgeInsets.all(0),
              child: Icon(
                  darkModeOn ? Icons.dark_mode_outlined : Icons.dark_mode,
                  size: 25),
              onPressed: () {
                setState(() {
                  darkModeOn = !darkModeOn;
                });
              },
            ),
          ),
        )
      ]),
    );
  }
}
